<template>
  <div class="tag-container" @click="toggleTag">
    <!-- 插槽记录的是标签的内容 -->
    <slot></slot>
  </div>
</template>

<script setup lang="ts">
import { useTagLists } from "./../../store";

let store = useTagLists();
const props = defineProps({
  // val pros 获取当前点击的tag的内容
  val: String,
});
const toggleTag = () => {
  // 接收到的props 使用props.val来使用
  // console.log(props.val);
  store.toggle(props.val as string);
};
</script>

<style scoped lang="less">
.tag-container {
  height: 50px;
  min-width: 20%;
  text-align: center;
  background-color: rgb(202, 202, 202);
  margin: 25px 20px 0px 10px;
  padding: 0px 10px;
  line-height: 50px;
  border-radius: 30px;
  font-size: 18px;
}
</style>
